import { Module } from '@nestjs/common'
import { ConfigModule } from '@nestjs/config'
import { TypeOrmModule } from '@nestjs/typeorm'
import { AsrConfig } from '~/config/asr.config'
import { OcrConfig } from '~/config/ocr.config'
import { OssConfig } from '~/config/oss.config'
import { AsrController } from './controllers/asr.controller'
import { OcrController } from './controllers/ocr.controller'
import { OssController } from './controllers/oss.controller'
import { AsrTaskEntity } from './entities/asr-task.entity'
import { OcrTaskEntity } from './entities/ocr-task.entity'
import { AsrService } from './services/asr.service'
import { OcrService } from './services/ocr.service'
import { OssService } from './services/oss.service'

@Module({
  imports: [
    ConfigModule.forRoot({ load: [OssConfig, AsrConfig, OcrConfig] }),
    TypeOrmModule.forFeature([
      AsrTaskEntity,
      OcrTaskEntity,
    ]),
  ],
  controllers: [
    OssController,
    AsrController,
    OcrController,
  ],
  providers: [
    OssService,
    AsrService,
    OcrService,
  ],
  exports: [
    OssService,
    AsrService,
    OcrService,
  ],
})
export class CommonModule {}
